package guiPersonale;

import java.awt.EventQueue;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JPanel;
import javax.swing.UIManager;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.CardLayout;
import java.awt.GridBagLayout;

import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;

import net.miginfocom.swing.MigLayout;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextPane;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;

public class HovedsidePersonale {

	private JFrame frame;
	private CardLayout cl = new CardLayout();
	private JPanel panelCont;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					HovedsidePersonale window = new HovedsidePersonale();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 * @throws SQLException 
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public HovedsidePersonale() throws FileNotFoundException, IOException, SQLException {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 * @throws SQLException 
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	private void initialize() throws FileNotFoundException, IOException, SQLException {
		frame = new JFrame("Sandwich deLuxe Staff System");
		frame.setBounds(100, 100, 600, 345);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JPanel panelMenu = new JPanel();
		panelMenu.setBounds(10, 11, 212, 284);
		frame.getContentPane().add(panelMenu);
		panelMenu.setLayout(null);
		panelMenu.setBorder(BorderFactory.createRaisedBevelBorder());
		
		
		
		JButton btnOpretVare = new JButton("Opret vare");
		btnOpretVare.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				cl.show(panelCont, "OpretVare");
			}
		});
		btnOpretVare.setBounds(32, 11, 137, 23);
		panelMenu.add(btnOpretVare);
		
		JButton btnRedigersletVare = new JButton("Rediger/slet vare");
		btnRedigersletVare.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				cl.show(panelCont, "RedigerVare");
			}
		});
		btnRedigersletVare.setBounds(32, 45, 137, 23);
		panelMenu.add(btnRedigersletVare);
		
		JButton btnIndstillinger = new JButton("Indstillinger");
		btnIndstillinger.setBounds(32, 79, 137, 23);
		panelMenu.add(btnIndstillinger);
		
		panelCont = new JPanel();
		panelCont.setBounds(232, 11, 342, 284);
		frame.getContentPane().add(panelCont);
		panelCont.setLayout(cl);
		
		JPanel panelVelkommen = new JPanel();
		panelVelkommen.setForeground(Color.BLACK);
//		JTextArea txtAreaVelkommen = new JTextArea();
//		txtAreaVelkommen.setEditable(false);
//		txtAreaVelkommen.setForeground(Color.BLACK);
//		txtAreaVelkommen.setBackground(UIManager.getColor("Button.background"));
//		txtAreaVelkommen.setText("Velkommen til Sandwich deLuxe \r\nStaff System");
//		
//		txtAreaVelkommen.setFont(new Font("Monospaced", Font.PLAIN, 18));
//		panelVelkommen.add(txtAreaVelkommen,"12345");
		panelCont.add(panelVelkommen, "Velkommen");
		
		JTextPane txtpnVelkommenTilSandwich = new JTextPane();
		txtpnVelkommenTilSandwich.setForeground(Color.BLACK);
		txtpnVelkommenTilSandwich.setBackground(UIManager.getColor("Button.background"));
		txtpnVelkommenTilSandwich.setFont(new Font("Tahoma", Font.PLAIN, 20));
		txtpnVelkommenTilSandwich.setEditable(false);
		txtpnVelkommenTilSandwich.setText("  Velkommen til\r\nSandwich deLuxe \r\n    Staff System");
		panelVelkommen.add(txtpnVelkommenTilSandwich);
		panelCont.setOpaque(true);
		cl.show(panelCont, "Velkommen");
		OpretVare ov = new OpretVare();
		RedigerVare rv = new RedigerVare();
		panelCont.add(ov, "OpretVare");
		panelCont.add(rv, "RedigerVare");
	}

	public JFrame getFrame() {
		return frame;
	}
}
